#ifndef SCRIPTCREATOR_H
#define SCRIPTCREATOR_H

#include <QtGui>
#include <defs/global.h>

#include "ui_scriptcreator.h"
#include <extensions/mainwindow.h>

#include <QtScript>

#include <extensions/context.h>

O_PRIVATE_DECLARE(ScriptCreator);
class ScriptCreator : public Optra::Extensions::MainWindow, private Ui::ScriptCreator {
    Q_OBJECT
public:
	ScriptCreator(Optra::Extensions::Context *context);
	~ScriptCreator();

private slots:
    void newFile();
    void open();
    void save();
    void saveAs();
    void openRecentFile();
    void run();
    void loadPlugin();
    void runDeclarative();
    void output(const QString& str);
    void error(const QScriptValue & exception);
private:

    void createActions();
    void createMenus();
    void loadFile(const QString &fileName);
    void saveFile(const QString &fileName);
    void setCurrentFile(const QString &fileName);
    void updateRecentFileActions();
    QString strippedName(const QString &fullFileName);

    O_PRIVATE_DECLARE_MEMBER(ScriptCreator)
};

#endif // SCRIPTCREATOR_H

